import { ApiProperty, PartialType } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsInt, IsOptional, Min } from "class-validator";

import { CreateArticleDto } from "./create-article.dto";

export class UpdateArticleDto extends PartialType(CreateArticleDto) {
    @IsOptional()
    @Transform(({ value }) => Number(value))
    @IsInt()
    @Min(0)
    @ApiProperty({ description: "浏览量", example: 0, required: false })
    views: number;
}
